
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>UCTB.preprocess.preprocessor &#8212; UCTB  documentation</title>
    <link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../index.html">UCTB  documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <h1>Source code for UCTB.preprocess.preprocessor</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>


<div class="viewcode-block" id="Normalizer"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.Normalizer">[docs]</a><span class="k">class</span> <span class="nc">Normalizer</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">X</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_min</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">min</span><span class="p">(</span><span class="n">X</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_max</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">max</span><span class="p">(</span><span class="n">X</span><span class="p">)</span>

<div class="viewcode-block" id="Normalizer.min_max_normal"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.Normalizer.min_max_normal">[docs]</a>    <span class="k">def</span> <span class="nf">min_max_normal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">X</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="n">X</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">_min</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_max</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">_min</span><span class="p">)</span></div>

<div class="viewcode-block" id="Normalizer.min_max_denormal"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.Normalizer.min_max_denormal">[docs]</a>    <span class="k">def</span> <span class="nf">min_max_denormal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">X</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">X</span> <span class="o">*</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_max</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">_min</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_min</span></div></div>

    <span class="c1"># def white_normal(self):</span>
    <span class="c1">#     pass</span>


<div class="viewcode-block" id="MoveSample"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.MoveSample">[docs]</a><span class="k">class</span> <span class="nc">MoveSample</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">feature_step</span><span class="p">,</span> <span class="n">feature_stride</span><span class="p">,</span> <span class="n">feature_length</span><span class="p">,</span> <span class="n">target_length</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">feature_step</span> <span class="o">=</span> <span class="n">feature_step</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">feature_stride</span> <span class="o">=</span> <span class="n">feature_stride</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">feature_length</span> <span class="o">=</span> <span class="n">feature_length</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">target_length</span> <span class="o">=</span> <span class="n">target_length</span>

<div class="viewcode-block" id="MoveSample.general_move_sample"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.MoveSample.general_move_sample">[docs]</a>    <span class="k">def</span> <span class="nf">general_move_sample</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
        <span class="n">feature</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">target</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">feature_length</span> <span class="o">-</span>
                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">feature_step</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">feature_stride</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_length</span> <span class="o">+</span> <span class="mi">1</span><span class="p">):</span>
            <span class="n">feature</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">data</span><span class="p">[</span><span class="n">i</span> <span class="o">+</span> <span class="n">step</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">feature_stride</span><span class="p">:</span> <span class="n">i</span> <span class="o">+</span> <span class="n">step</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">feature_stride</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">feature_length</span><span class="p">]</span>
                            <span class="k">for</span> <span class="n">step</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">feature_step</span><span class="p">)])</span>
            <span class="n">target</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">i</span> <span class="o">+</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">feature_step</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">feature_stride</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">feature_length</span><span class="p">:</span>\
                               <span class="n">i</span> <span class="o">+</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">feature_step</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">feature_stride</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">feature_length</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_length</span><span class="p">])</span>

        <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">feature</span><span class="p">),</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">target</span><span class="p">)</span></div></div>


<div class="viewcode-block" id="ST_MoveSample"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.ST_MoveSample">[docs]</a><span class="k">class</span> <span class="nc">ST_MoveSample</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">closeness_len</span><span class="p">,</span> <span class="n">period_len</span><span class="p">,</span> <span class="n">trend_len</span><span class="p">,</span> <span class="n">target_length</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">daily_slots</span><span class="o">=</span><span class="mi">24</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_c_t</span> <span class="o">=</span> <span class="n">closeness_len</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_p_t</span> <span class="o">=</span> <span class="n">period_len</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_t_t</span> <span class="o">=</span> <span class="n">trend_len</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_target_length</span> <span class="o">=</span> <span class="n">target_length</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_daily_slots</span> <span class="o">=</span> <span class="n">daily_slots</span>

        <span class="c1"># 1 init Move_Sample object</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">move_sample_closeness</span> <span class="o">=</span> <span class="n">MoveSample</span><span class="p">(</span><span class="n">feature_step</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_c_t</span><span class="p">,</span> <span class="n">feature_stride</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
                                                <span class="n">feature_length</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">target_length</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_target_length</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">move_sample_period</span> <span class="o">=</span> <span class="n">MoveSample</span><span class="p">(</span><span class="n">feature_step</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_p_t</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">feature_stride</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_daily_slots</span><span class="p">),</span>
                                             <span class="n">feature_length</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">target_length</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">move_sample_trend</span> <span class="o">=</span> <span class="n">MoveSample</span><span class="p">(</span><span class="n">feature_step</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_t_t</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">feature_stride</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_daily_slots</span><span class="p">)</span> <span class="o">*</span> <span class="mi">7</span><span class="p">,</span>
                                            <span class="n">feature_length</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">target_length</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>

<div class="viewcode-block" id="ST_MoveSample.move_sample"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.ST_MoveSample.move_sample">[docs]</a>    <span class="k">def</span> <span class="nf">move_sample</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>

        <span class="c1"># 2 general move sample</span>
        <span class="n">closeness</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">move_sample_closeness</span><span class="o">.</span><span class="n">general_move_sample</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
        <span class="n">period</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">move_sample_period</span><span class="o">.</span><span class="n">general_move_sample</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
        <span class="n">trend</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">move_sample_trend</span><span class="o">.</span><span class="n">general_move_sample</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>

        <span class="c1"># 3 remove the front part</span>
        <span class="n">min_length</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">closeness</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">period</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">trend</span><span class="p">))</span>
        <span class="n">closeness</span> <span class="o">=</span> <span class="n">closeness</span><span class="p">[</span><span class="o">-</span><span class="n">min_length</span><span class="p">:]</span>
        <span class="n">y</span> <span class="o">=</span> <span class="n">y</span><span class="p">[</span><span class="o">-</span><span class="n">min_length</span><span class="p">:]</span>
        <span class="n">period</span> <span class="o">=</span> <span class="n">period</span><span class="p">[</span><span class="o">-</span><span class="n">min_length</span><span class="p">:]</span>
        <span class="n">trend</span> <span class="o">=</span> <span class="n">trend</span><span class="p">[</span><span class="o">-</span><span class="n">min_length</span><span class="p">:]</span>

        <span class="c1"># 4 remove tail of period and trend</span>
        <span class="n">period</span> <span class="o">=</span> <span class="n">period</span><span class="p">[:,</span> <span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
        <span class="n">trend</span> <span class="o">=</span> <span class="n">trend</span><span class="p">[:,</span> <span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_c_t</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_c_t</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">closeness</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">transpose</span><span class="p">(</span><span class="n">closeness</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">closeness</span><span class="o">.</span><span class="n">shape</span><span class="p">)))</span> <span class="o">+</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">closeness</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([])</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_p_t</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_p_t</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">period</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">transpose</span><span class="p">(</span><span class="n">period</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">period</span><span class="o">.</span><span class="n">shape</span><span class="p">)))</span> <span class="o">+</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">period</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([])</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_t_t</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_t_t</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">trend</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">transpose</span><span class="p">(</span><span class="n">trend</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">trend</span><span class="o">.</span><span class="n">shape</span><span class="p">)))</span> <span class="o">+</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">trend</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([])</span>

        <span class="n">y</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">transpose</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="o">.</span><span class="n">shape</span><span class="p">)))</span> <span class="o">+</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span>

        <span class="k">return</span> <span class="n">closeness</span><span class="p">,</span> <span class="n">period</span><span class="p">,</span> <span class="n">trend</span><span class="p">,</span> <span class="n">y</span></div></div>


<div class="viewcode-block" id="SplitData"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.SplitData">[docs]</a><span class="k">class</span> <span class="nc">SplitData</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>

<div class="viewcode-block" id="SplitData.split_data"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.SplitData.split_data">[docs]</a>    <span class="nd">@staticmethod</span>
    <span class="k">def</span> <span class="nf">split_data</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">ratio_list</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ratio_list</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">)</span>
            <span class="n">ratio_list</span> <span class="o">=</span> <span class="n">ratio_list</span> <span class="o">/</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">)</span>
        <span class="k">return</span> <span class="p">[</span><span class="n">data</span><span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="nb">sum</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="n">e</span><span class="p">])</span><span class="o">*</span><span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)):</span>
                     <span class="nb">int</span><span class="p">(</span><span class="nb">sum</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="n">e</span><span class="o">+</span><span class="mi">1</span><span class="p">])</span><span class="o">*</span><span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">))]</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">))]</span></div>

<div class="viewcode-block" id="SplitData.split_feed_dict"><a class="viewcode-back" href="../../../UCTB.preprocess.html#UCTB.preprocess.preprocessor.SplitData.split_feed_dict">[docs]</a>    <span class="nd">@staticmethod</span>
    <span class="k">def</span> <span class="nf">split_feed_dict</span><span class="p">(</span><span class="n">feed_dict</span><span class="p">,</span> <span class="n">sequence_length</span><span class="p">,</span> <span class="n">ratio_list</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ratio_list</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">)</span>
            <span class="n">ratio_list</span> <span class="o">=</span> <span class="n">ratio_list</span> <span class="o">/</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">)</span>

        <span class="k">return</span> <span class="p">[{</span><span class="n">key</span><span class="p">:</span> <span class="n">value</span><span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="nb">sum</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="n">e</span><span class="p">])</span><span class="o">*</span><span class="nb">len</span><span class="p">(</span><span class="n">value</span><span class="p">)):</span><span class="nb">int</span><span class="p">(</span><span class="nb">sum</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="n">e</span><span class="o">+</span><span class="mi">1</span><span class="p">])</span><span class="o">*</span><span class="nb">len</span><span class="p">(</span><span class="n">value</span><span class="p">))]</span>
                 <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="o">==</span> <span class="n">sequence_length</span> <span class="k">else</span> <span class="n">value</span> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">feed_dict</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
                <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">ratio_list</span><span class="p">))]</span></div></div>
</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../index.html">UCTB  documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2019, Di Chai, Leye Wang, Jin Xu, Wenjie Yang, Liyue Chen.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.1.
    </div>
  </body>
</html>